http://web.cse.ohio-state.edu/~shen.94/681/Site/DDA.html

  //  Assuming that the slope 0<m<1,  xa <xb, and we do truncation to get the integer pixel positions

      IntegerLineDDA(int xa, int ya, int xb, int yb)    // to draw a line from (xa, ya) to (xb, yb)
      {
           int dx = xb - xa, dy = yb - ya;
           int steps = dx, k;
           int x = xa, y = ya;
           int c = 0;
           Draw(xa, ya);   // draw the pixel (xa, ya)
           for (k=0; k<steps; k++) {
                  x = x + 1;
                  c = c + dy;  // update the fractional part
                  if (c > dx)   { // (that is, the fractional part is greater than 1 now
                        y = y+1;   // carry the overflowed integer over
                        c = c - dx  // update the fractional part
                        Draw(x, y);   // draw the new pixel
            }
       }